import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);
const routes = [
    // 二级路由
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/home',
        component: () => import('../components/common/Home.vue'),
        meta: {
            title: '自述文件'
        },
        redirect: "/System",
        children: [{
                path: '/System',
                component: () => import( /* webpackChunkName: "systes" */ '../components/page/System.vue'),
                meta: {
                    title: "系统首页"
                }
            },



            {
                path: '/BaseTable',
                component: () => import( /* webpackChunkName: "table" */ '../components/page/BaseTable.vue'),
                meta: {
                    title: '基础表格'
                }
            },
            {
                path: '/tabs',
                component: () => import( /* webpackChunkName: "tabs" */ '../components/page/Tabs.vue'),
                meta: {
                    title: 'tab选项卡'
                }
            },
            {
                path: '/icon',
                component: () => import( /* webpackChunkName: "icon" */ '../components/page/Icon.vue'),
                meta: {
                    title: '自定义图标'
                }
            },
            {
                path: '/form',
                component: () => import( /* webpackChunkName: "form" */ '../components/page/JcForm.vue'),
                meta: {
                    title: '基本表单'
                }
            },
            {
                path: '/tabs',
                component: () => import( /* webpackChunkName: "tabs" */ '../components/page/Tabs.vue'),
                meta: {
                    title: 'tab选项卡'
                }
            },
            {
                path: '/i18n',
                component: () => import( /* webpackChunkName: "form" */ '../components/page/i18n.vue'),
                meta: {
                    title: '后'
                }
            },
            {
                path: '/drag',
                component: () => import( /* webpackChunkName: "form" */ '../components/page/DragDialog.vue'),
                meta: {
                    title: '拖拽'
                }
            },
            {
                path: '/dialog',
                component: () => import( /* webpackChunkName: "form" */ '../components/page/DragList.vue'),
                meta: {
                    title: '拖拽排序'
                }
            },
            {
                path: '/donate',
                component: () => import( /* webpackChunkName: "form" */ '../components/page/donate.vue'),
                meta: {
                    title: '二维码'
                }
            },
            {
                path: '/Markdown',
                component: () => import( /* webpackChunkName: "form" */ '../components/page/Markdown.vue'),
                meta: {
                    title: 'markdown编辑器'
                }
            },
            {
                path: '/editor',
                component: () => import( /* webpackChunkName: "form" */ '../components/page/Markdown.vue'),
                meta: {
                    title: '富文本编辑器'
                }
            },
            {
                path: '/upload',
                component: () => import( /* webpackChunkName: "form" */ '../components/page/Upload.vue'),
                meta: {
                    title: '文件上传'
                }
            },
            {
                // 国际化组件
                path: '/i18n',
                component: () => import( /* webpackChunkName: "i18n" */ '../components/page/i18n.vue'),
                meta: {
                    title: '国际化'
                }
            },
            {
                // 权限页面
                path: '/permission',
                component: () => import( /* webpackChunkName: "permission" */ '../components/page/Permission.vue'),
                meta: {
                    title: '权限测试',
                    permission: true
                }
            },
            {
                //404
                path: '/404',
                component: () => import( /* webpackChunkName: "404" */ '../components/page/404.vue'),
                meta: {
                    title: '404'
                }
            },
            {

                path: '/403',
                component: () => import( /* webpackChunkName: "403" */ '../components/page/403.vue'),
                meta: {
                    title: '403'
                }
            },
            {
                // vue-schart组件
                path: '/charts',
                component: () => import( /* webpackChunkName: "chart" */ '../components/page/BaseCharts.vue'),
                meta: {
                    title: 'schart图表'
                }
            },
            {
                //数据统计 单独  echart图表
                path: '/echart',
                component: () => import( /* webpackChunkName: "chart" */ '../components/page/echart.vue'),
                meta: {
                    title: 'echart图表'
                }
            },
            {
                //图书管理
                path: '/tushu',
                component: () => import( /* webpackChunkName: "tushu" */ '../components/page/tushu.vue'),
                meta: {
                    title: '图书'
                }
            },
            {
                //作者管理
                path: '/author',
                component: () => import( /* webpackChunkName: "author" */ '../components/page/author.vue'),
                meta: {
                    title: '作者管理'
                }
            }, 
            {
                //字典配置
                path: '/Dictionaries',
                component: () => import( /* webpackChunkName: "Dictionaries" */ '../components/page/Dictionaries.vue'),
                meta: {
                    title: '字典配置'
                }
            }, 
            {
                //小福利
                path: '/welfare',
                component: () => import( /* webpackChunkName: "welfare" */ '../components/page/welfare.vue'),
                meta: {
                    title: '小福利'
                }
            },
            {
                //部门管理
                path: '/department',
                component: () => import( /* webpackChunkName: "department" */ '../components/page/department.vue'),
                meta: {
                    title: '部门管理'
                }
            },
            {
                //用户管理
                path: '/user',
                component: () => import( /* webpackChunkName: "user" */ '../components/page/user.vue'),
                meta: {
                    title: '用户管理'
                }
            },
            {
                //角色管理
                path: '/role',
                component: () => import( /* webpackChunkName: "role" */ '../components/page/role.vue'),
                meta: {
                    title: '角色管理'
                }
            },
            {
                //菜单权限
                path: '/menu',
                component: () => import( /* webpackChunkName: "menu" */ '../components/page/menu.vue'),
                meta: {
                    title: '菜单权限'
                }
            },
            {
                // 添加列表
                path: '/addlist',
                component: () => import( /* webpackChunkName: "yhlist" */ '../components/page/addlist.vue'),
                meta: {
                    title: '用户列表',
                    permission: true
                }
            },
            {
                // 用户列表
                path: '/yhlist',
                component: () => import( /* webpackChunkName: "yhlist" */ '../components/page/yhlist.vue'),
                meta: {
                    title: '用户列表',
                    permission: true
                }
            },
            {
                // 商家列表
                path: '/sjlist',
                component: () => import( /* webpackChunkName: "sjlist" */ '../components/page/sjlist.vue'),
                meta: {
                    title: '商家列表',
                    permission: true
                }
            },
            {
                // 食品列表
                path: '/foodlist',
                component: () => import( /* webpackChunkName: "foodlist" */ '../components/page/foodlist.vue'),
                meta: {
                    title: '食品列表',
                    permission: true
                }
            },
            {
                // 订单列表
                path: '/orderlist',
                component: () => import( /* webpackChunkName: "splist" */ '../components/page/orderlist.vue'),
                meta: {
                    title: '订单列表',
                    permission: true
                }
            },
            {
                // 管理员列表
                path: '/administrators',
                component: () => import( /* webpackChunkName: "administrators" */ '../components/page/administrators.vue'),
                meta: {
                    title: '管理员列表',
                    permission: true
                }
            },

            {
                //添加店铺
                path: '/addpu',
                component: () => import( /* webpackChunkName: "addpu" */ '../components/page/addpu.vue'),
                meta: {
                    title: '添加店铺列表',
                    permission: true
                }
            },
            {
                //添加商品
                path: '/addsp',
                component: () => import( /* webpackChunkName: "addsp" */ '../components/page/addsp.vue'),
                meta: {
                    title: '添加商品列表',
                    permission: true
                }
            },
            {
                //图表
                path: '/tubiao',
                component: () => import( /* webpackChunkName: "tubiao" */ '../components/page/tubiao.vue'),
                meta: {
                    title: '图表',
                    permission: true
                }
            },
            {
                //说明
                path: '/explain',
                component: () => import( /* webpackChunkName: "tubiao" */ '../components/page/explain.vue'),
                meta: {
                    title: '说明',
                    permission: true
                }
            },


        ]
    },
    {
        path: '/login',
        component: () => import( /* webpackChunkName: "login" */ '../components/page/Login.vue'),
        meta: {
            title: '登录'
        }
    },
    // {
    //     path: '*',
    //     redirect: '/404'
    // }
]

const router = new Router({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router